<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
        <html><head>
        <link rel="stylesheet" type="text/css" href="apidocs.css"/>
        <title>API docs for &ldquo;sympy.ntheory.partitions_&rdquo;</title>
        </head>
        <body><h1 class="module">Module s.n.partitions_</h1><span id="part">Part of <a href="sympy.ntheory.html">sympy.ntheory</a></span><div class="toplevel"><div class="undocumented">Undocumented</div></div><table class="children"><tr class="function"><td>Function</td><td><a href="#sympy.ntheory.partitions_.npartitions">npartitions</a></td><td><div><p>Calculate the partition function P(n), i.e. the number of ways that</p>
</div></td></tr></table>
            <div class="function">
            <div class="functionHeader">def <a name="sympy.ntheory.partitions_.npartitions">npartitions(n):</a></div>
            <div class="functionBody"><div><p>Calculate the partition function P(n), i.e. the number of ways that n 
can be written as a sum of positive integers.</p>
<p>P(n) is computed using a straightforward implementation of the 
Hardy-Ramanujan-Rademacher formula, described e.g. at 
http://mathworld.wolfram.com/PartitionFunctionP.html</p>
<p>The speed is decent up to n = 10**5 or so. The function has been tested 
to give the correct result for n = 10**6.</p>
</div></div>
            </div></body>
        